#include<iostream>
#include<vector>
using namespace std;

//从递归入手
//斐波那契数列：简单的原因：
//days[i... ... 的最小花费
int durations[3] ={1,3,7};
int f(vector<int>& days,vector<int>& costs,int i)
{
    //最小花费
    //以实例以为例子：[1,4,6,7,8,20]
    //1 day[i + 1... ... 
    //3 day[i + 1... ...
    //7 day[i + 3... ...
    if(i == days.size())
    {
        return 0;
    }
    int ans = INT_MAX; 
    for(int k = 0,j = i;k < 3;k++)
    {
        //确定j
        //day[i] + duration[k] > day[j]
        while(j < days.size() && days[i] + durations[k]  - 1 >= days[j])
        {
            j++;
        }
        ans = min(ans,costs[k] + f(days,costs,j));
    }
    return ans;
}
int mincostTickets(vector<int>& days, vector<int>& costs) {
    f(days,costs,0);
}
